
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Square.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Square)
{
        TEST(should be able to calculate area : 2*2=4)
        {
                Square square(2);
                ASSERT_EQ(4, square.getArea());
        }

        TEST(should be able to calculate area : (2*(2+2))=8)
        {
                Square square(2);
                ASSERT_EQ(8, square.getPerimeter());
        }

        TEST(should be able to calculate area : 100.00*100.00=10000.00)
        {
                Square square(100.00);
                ASSERT_EQ(10000.00, square.getArea());
        }
        TEST(should be able to calculate perimeter : (100.00+100.00)*2=400.00)
        {
                Square square(100.00);
                ASSERT_EQ(400.00, square.getPerimeter ());
        }

        TEST(should be able to construct square : 100.02)
        {
                Square square(100.02);
                ASSERT_EQ((float)(0.00), square.getSide());
        }

        TEST(should be able to construct square : -0.01)
        {
                Square square(-0.01);
                ASSERT_EQ((float)(0.00), square.getArea());
                ASSERT_EQ((float)(0.00), square.getPerimeter());
        }

        TEST(should be able to check input length and width value, and keep the right one : -0.01 * -0.01)
        {
                Square square(-0.01);
                ASSERT_EQ(true, square.setSide(0.88));
                ASSERT_EQ(false, square.setSide(100.08));
                ASSERT_EQ((float)0.88, square.getSide());
        }
};


